﻿/*--------------------------------------
 * Author: 刘楠   Date: 08/10/2007
 * -------------------------------------*/

using System;
using System.Data;
using System.Text;
using Entity;
using BussinessLib;
using Global;


/// <summary>
/// OrderManage 的摘要说明
/// </summary>
public class OrderManager:BaseManager
{
	public OrderManager()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}

    /// <summary>
    /// 插入一条订餐记录
    /// </summary>
    /// <param name="record">订单</param>
    /// <returns></returns>
   bool BaseManager.AddObject(object obj)
    {
        Order record = (Order)obj;
        StringBuilder sb = new StringBuilder();
        sb.Append("insert into OrderRecord (ord_dtBookTime,ord_dtArrivalTime,ord_nTableNum,ord_nState,ord_sDesc,ord_nUserID) values(");
        sb.Append("'"+ record.BookTime + "','" + record.ArrivalTime + "'," + record.TableNum + "," + record.TableID+",'"+record.Description+"',"+record.UserID+");");//tableID为餐馆号

        Helper hp = new Helper();

        if (hp.ExecuteSql(sb.ToString()))
            return true;
        else
            return false;
    }

    bool BaseManager.DeleteObject(object obj)
    {
        int id = (int)obj; 
        StringBuilder sb = new StringBuilder();
        sb.Append("DELETE FROM OrderRecord WHERE (ord_nID =" + id + ");");

        Helper hp = new Helper();

        if( hp.ExecuteSql(sb.ToString()))
            return true;
        else
            return false;
    }

    bool BaseManager.UpdateObject(object obj){

        return true;
    }
}
